<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="huoyun" uri="/huoyun"%>
<%@ taglib uri="/struts-tags" prefix="s"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>搜索车源</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css"
			href="${pageContext.request.contextPath}/theme/css/main.css">
		<link rel="stylesheet" type="text/css"
			href="${pageContext.request.contextPath}/theme/css/style_userCenter.css">
		<link rel="stylesheet" type="text/css"
			href="${pageContext.request.contextPath}/theme/css/dialog.css">
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/theme/js/jquery-1.6.js"></script>
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/theme/js/dialog.js"></script>
		<script type="text/javascript">
			function selectBidCarInfo()
			{
				var selectedCarIds = "";
				
				$("input[name='selectedCarIds']:checked").each(function(){
					selectedCarIds += $(this).val() + "|";
				});
				
				alert(selectedCarIds);
				if(selectedCarIds != null && selectedCarIds != "")
				{
				
					selectedCarIds = selectedCarIds.substring(0, selectedCarIds.length - 1);
					
					$.ajax({
				               type: "POST",
				               url: "${pageContext.request.contextPath}/car/chooseCar.action",
				               data: {"selectedCarIds" : selectedCarIds},
				               dataType: "html",
				               success: function(data) 
				               {
				               		alert(data)
							   },
							   error: function()
							   {
							        alert("系统忙，请稍后再试。");
							   }
			    	});
				}
				else
				{
					alert("请选择应标的车辆！");
				}
			}
		</script>
	</head>
	<body>
		<div>
			<jsp:include page="../userAdmin/nav.jsp">
				<jsp:param value="nav_main" name="nav" />
			</jsp:include>
		</div>
		<div class="realCer">
			<!--主体部分-->
			<div class="realMain clearfix mt10">
				<!--左侧菜单-->
				<div class="realLeft" id="meunLeft">
					<jsp:include page="../userAdmin/leftMenu.jsp">
						<jsp:param value="con_nav_main" name="con_nav" />
					</jsp:include>
				</div>
				<!--中间-->
				<div class="realRight ml10">
					<!--中间-->
					<div class="realR_left">
						<div class="box" style="width: 805px;">
							<div class="tit">
								<strong>应标车辆列表</strong>
							</div>
							<div class="con">
									<div id="mySelectedBidCarInfos">
										
									</div>
									<table class="listTable">
										<tr>
											<th>序号</th>
											<th>车牌号</th>
											<th>起始地/目的地</th>
											<th>发车时间区间</th>
											<th>可载</th>
											<th>报价</th>
											<th>是否返程</th>
											<th>操作</th>
										</tr>
										<s:if test="bidCarInfos && bidCarInfos.size > 0">
											<s:iterator value="bidCarInfos" id="pubInfo"
												status="st">
												<tr id="bidCarInfo_<s:property value="#pubInfo.carId"/>">
													<td>
														<s:property value="#st.index+1" />
													</td>
													<td>
														<s:property value="#pubInfo.carNumber" />
													</td>
													<td>
														<s:iterator var="carRoute" value="carRouteList"
															status="st">
															<huoyun:regionSelect type="view"
																provinceValue="${carRoute.startProvince }"
																cityValue="${carRoute.startCity}"
																townValue="${carRoute.startTown}" />-
	        												<huoyun:regionSelect type="view"
																provinceValue="${carRoute.endProvince}"
																cityValue="${carRoute.endCity}"
																townValue="${carRoute.endTown}" /><br/>
														</s:iterator>
													</td>
													<td>
														始:<s:property value="#pubInfo.starttime" />
														<br>
														终:<s:property value="#pubInfo.endtime" />
													</td>
													<td>
														<s:property value="#pubInfo.loadAmount" />
														<huoyun:customSelect value="${pubInfo.unit }"
															mode="measureType" type="view" />
													</td>
													<td><s:property value="#pubInfo.bidInfoPrice" />元</td>
													<td>
														<s:if test="#pubInfo.retour==0">是</s:if>
														<s:elseif test="#pubInfo.retour==1">否</s:elseif>
													</td>
													<td id="operate_<s:property value="#pubInfo.carId"/>">
														<input type="checkbox" name="selectedCarIds" value="<s:property value="#pubInfo.carId"/>" />
													</td>
												</tr>
											</s:iterator>	
											<tr>
												<td colspan="8" >
												<div class="fr"><input onclick="selectBidCarInfo()" type="button" value="将选择的车辆加入我的自选包"/></div>
												</td>
											</tr>
										</s:if>
										<s:else>
											<tr>
												<td colspan="8">
													没有应标的车辆信息！
												</td>
											</tr>
										</s:else>
									</table>
							</div>
						</div>
					</div>
					<!-- 中间 -->
				</div>
				<!--中由-->
			</div>
		</div>
		<div>
			<jsp:include page="/footer.jsp"></jsp:include>
		</div>
	</body>
</html>
